from APITest.online_course_2018.Day3.woniusales import WoniuSales
import http.client, json

ws = WoniuSales()
cookie = ws.login()
# print(cookie)

conn = http.client.HTTPConnection('localhost', 8081)
headers = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
data = 'customerphone=&page=a.txt'
conn.request('POST', '/WoniuSales/customer/search', headers=headers, body=data)
resp = conn.getresponse().read().decode()
# print(resp)
print(type(resp))

# loads:把已编码好的Json字符串解码成python对象
# dumps:把python对象编码成json串

json_obj = json.loads(resp)
print(json_obj)
print(type(json_obj[0]))
